<!--分组赋值-->
<template>
    <div class="grouping">
        <el-row class="form-item">
            <span>赋值依据</span>
            <el-select size="mini" v-model="assignmentValue" class="assignment-value" @change="assignmentHandle" filterable>
                <el-option
                    v-for="item in itemList"
                    :key="item.value"
                    :label="item.name"
                    :value="item.value"></el-option>
            </el-select>
            <span style="color: #D8DCE5" >分组名称即赋值</span>
        </el-row>
        <template v-if="isText(assignmentValue) === 'VARCHAR2' && groupFlag">
            <el-row class="cl1">
                <el-col :span="12" >
                    <el-button size="mini">已选择{{selectedNum}}项</el-button>
                </el-col>
                <el-col :span="12">
                    <i @click="addGroup(groupInfo, '0')">添加分组</i>
                    <el-dropdown v-if="selectedNum !== 0">
                <span class="el-dropdown-link" >
                    移动到<i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item v-for="(groupItem,index) in groupInfo" :key="index" @click.native="dropdownClick(groupItem)">{{groupItem.groupName}}</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </el-col>
            </el-row>
            <el-row class="cl1">
                <el-input placeholder="搜索" size="mini" style="width: 80%" clearable v-model="searchValue" @clear="clearCollapse">
                    <el-button slot="prepend" class="el-icon-search" @click="searchCollapse(searchValue)"></el-button>
                </el-input>
            </el-row>
            <el-row class="cl1">
                <div class="group-content">
                    <div v-if='!searchFlag'>
                        没有可选项
                    </div>
<!--                    <el-collapse v-if="!searchFlag && isSearch">-->
<!--                        <el-collapse-item v-for="(groupItem,index) in groupInfoTemp" :key="groupItem.name" >-->
<!--                            <template slot="title">-->
<!--                                {{groupItem.name}}-->
<!--                            </template>-->
<!--                            <div style="height: 100px;overflow: hidden auto">-->
<!--                                <div v-for="(item,index) in groupItem.data" style="position: relative; margin-left: 20px; float: left;height: 30px;cursor: pointer;" :key="index"-->
<!--                                     @click.stop="handleClick($event, item, groupItem.name)">-->
<!--                                    {{item}}-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </el-collapse-item>-->
<!--                    </el-collapse>-->
                    <el-collapse v-if="searchFlag">
                        <el-collapse-item v-for="(groupItem,index) in groupInfo" :key="groupItem.groupName" v-if="groupItem.groupShow">
                            <template slot="title">
                                {{groupItem.groupName}}
                                <i class="el-icon-edit" v-if="index !== 0 && isSearch" style="margin-left: 20px" @click="editGroup(groupInfo, groupItem)"></i>
                                <i class="el-icon-delete" v-if="index !== 0 && isSearch" style="margin-left: 20px" @click="deleteGroup(groupItem,index)" ></i>
                            </template>
                            <div style="height: 100px;overflow: hidden auto">
                                <div v-for="(item,index) in groupItem.content" style="position: relative; margin-left: 20px; float: left;height: 30px;cursor: pointer;" :key="index"
                                     @click.stop="handleClick($event, item, groupItem.groupName)">
                                    <template v-if="!item.searchFlag">
                                        {{item.value}}
                                    </template>
                                </div>
                            </div>
                        </el-collapse-item>
                    </el-collapse>
                </div>
            </el-row>
            <el-row class="cl1">
                <el-checkbox v-model="checked" @change="otherHandle">未分组的值分到
                    <template>
                        <el-input size="mini" v-model="other" :disabled="disabledFlag" style="width: 150px"> </el-input>
                    </template>
                </el-checkbox>
            </el-row>
        </template>
        <!--数值-->
        <template v-if="isText(assignmentValue) === 'NUMBER'">
            <el-row class="form-item">
                    <span>分组赋值方式</span>
                    <el-select size="mini" v-model="assignmentMethod" @change="assignmentHandle" filterable>
                        <el-option
                            v-for="item in methodList"
                            :key="item.value"
                            :label="item.name"
                            :value="item.value"></el-option>
                    </el-select>
            </el-row>
            <el-row v-if="assignmentMethod === '2'" class="cl1">
                <i @click="addGroup(intervalTempList, '1')" class="add-group">添加分组</i>
            </el-row>
            <div v-if="assignmentMethod === '2'" class="group-content cl1">
                <template  v-for="(interval,index) in intervalTempList">
                    <el-row class="numgroup-item erro">{{message[index]}}</el-row>
                    <el-row class="numgroup-item":class="message[index] == null || undefined || '' ? 'num-method': ''">
                        <el-col :span="6">
                            <el-input size="mini" v-model="interval.groupName" @focus="selectValue($event)"></el-input>
                        </el-col>
                        <el-col :span="6" style="margin-left: 10px">
                            <el-input size="mini" class="input-with-select" v-model="interval.min" @input="numInputValidate(intervalTempList,index)">
                                <el-select v-model="interval.closeMax" placeholder="" size="mini" style="width: 65px" slot="append" @change="appendHandle(intervalTempList,index)">
                                    <el-option v-for="item in appendList"
                                               :key="item.value"
                                               :value="item.value"
                                               :label="item.name"></el-option>
                                </el-select>
                            </el-input>
                        </el-col>
                        <el-col :span="1">值</el-col>
                        <el-col :span="7">
                            <el-input size="mini" class="input-with-select" v-model="interval.max" @input="numInputValidate(intervalTempList,index)">
                                <el-select v-model="interval.closeMin" placeholder="" size="mini" style="width: 65px" slot="prepend" @change="prependHandle(intervalTempList,index)">
                                    <el-option v-for="item in appendList"
                                               :key="item.value"
                                               :value="item.value"
                                               :label="item.name"
                                    ></el-option>
                                </el-select>
                            </el-input>
                        </el-col>
                        <el-col :span="3">
<!--                            <i class="el-icon-edit" style="margin-left: 20px" @click="editNumGroup(groupInfo, groupItem)"></i>-->
                            <i class="el-icon-delete" style="margin-left: 20px" @click="deleteNumGroup(interval,index)"></i>
                        </el-col>
                    </el-row>
                </template>
            </div>
            <div v-if="assignmentMethod === '3'" class="form-item">
                <span>区间间隔</span>
                <el-input size="mini" v-enter-number2 type="text" v-model="defaultInterval" class="interval-value" @blur="blurHandle"></el-input>
                <span class="intervalMsg1">{{intervalMsg1}}</span>
                <div class="intervalMsg2">{{intervalMsg2}}</div>
            </div>
            <div class="other-group cl1" v-if="assignmentMethod === '2'">
                <el-checkbox v-model="checked" @change="otherHandle">未分组的值分到
                    <template>
                        <el-input size="mini" v-model="other" :disabled="disabledFlag" style="width: 150px"> </el-input>
                    </template>
                </el-checkbox>
            </div>
            <div :class="assignmentMethod === '2' ? 'bottom-msg': 'bottom-msg1'">
                分组设置：（本维度值：最小值{{min}}，最大值{{max}}）
            </div>
        </template>
        <rename-group ref="renameGroup" @saveName="getName"></rename-group>
    </div>
</template>

<script>
    import RenameGroup from './RenameGroup'
    import ajax from '@api/ajax'
    import {GET_TABLEFILTER_INFO, SEARCH_ADDROW, QUERY_GROUPING} from '@api/url'
    import $ from 'jquery'
    import TemplateIndex from '../../panel/templateConfig/TemplateIndex'
    import {formatDate} from '../../../assets/js/date'
    export default {
        name: 'Grouping',
        components: {TemplateIndex, RenameGroup},
        data () {
            return {
                groupFlag: 0, // （0 文本字段 1 数值字段）
                selectedNum: 0, // 文本数据计数
                selectedList: [], // 保存选择的文本数据
                assignmentValue: '', // 赋值依据绑定值
                columnInfo: [], // 保存数值和文本数组
                itemList: [
                    // {
                    //     name: '商品编码',
                    //     value: 'code'
                    // },
                    // {
                    //     name: '条形码',
                    //     value: 'code1'
                    // },
                    // {
                    //     name: '成本额',
                    //     value: 'money'
                    // }
                ], // 赋值依据下拉列表
                groupInfo: [
                    // {
                    //     name: '未分组',
                    //     data: [
                    //         {
                    //             searchFlag: false,
                    //             value: '1'
                    //         },{
                    //             searchFlag: false,
                    //             value: '2'
                    //         },{
                    //             searchFlag: false,
                    //             value: '32222'
                    //         }
                    //     ],
                    //     value: 'STATE',
                    //     groupShow: true // 搜索组时，判断如果data里没有一个searchFlag则不标题不作显示
                    // },
                    // {
                    //     name: '分组1',
                    //     data: [
                    //         {
                    //             searchFlag: false,
                    //             value: '32'
                    //         },{
                    //             searchFlag: false,
                    //             value: '44'
                    //         }
                    //     ],
                    //     value: 'STATE',
                    //     groupShow: true
                    // },
                    // {
                    //     name: '分组2',
                    //     data: [
                    //         {
                    //             searchFlag: false,
                    //             value: '55'
                    //         },{
                    //             searchFlag: false,
                    //             value: '67'
                    //         }
                    //     ],
                    //     value: 'STATE',
                    //     groupShow: true
                    // }
                ], // 文本数据数组
                searchValue: '', // 文本搜索绑定值
                searchFlag: false, // 搜索标识判断是否显示搜索的分组（点不点那个搜索按钮）
                isSearch: true, // 搜索到了组后,编辑删除按钮是否显示标记
                assignmentMethod: '', // 数值分组赋值方式
                methodList: [
                    {
                        name: '自定义',
                        value: '2'
                    }, {
                        name: '自动',
                        value: '3'
                    }
                ], // 数值分组赋值方式下拉框
                appendInput: [
                    0,
                    200000008,
                    400000006,
                    600000004,
                    800000002], // 后置输入框值
                appendValue: [], // 后置下拉框绑定值
                appendList: [
                    {
                        name: '<',
                        value: true
                    },
                    {
                        name: '<=',
                        value: false
                    }
                ], // 后置列表
                prependInput: [], // 前置输入框值
                prependValue: [], // 前置下拉框绑定值
                intervalList: [
                    // 0,
                    // 200000008,
                    // 400000006,
                    // 600000004,
                    // 800000002,
                    // 1000000000
                ],
                intervalTempList: [], // 保存临时的数值数据
                message: [], // 提示信息
                defaultInterval: '', // 区间间隔
                other: '其他',
                checked: true,
                disabledFlag: false,
                groupFlag: false, // 标识下拉框值对应的分组信息
                min: 0, // 维度最小值
                max: 0, // 维度最大值
                intervalMsg1: '', // 区间间隔分组提示信息
                intervalMsg2: '333333'
            }
        },
        props: {
            menuId: {
                type: String
            }
        },
        methods: {
            /** ***********************公共方法******************************/
            // 文本和数值添加分组公共方法
            addGroup (itemList, itemListFlag) {
                if (itemListFlag === '0') {
                    itemList.push({
                        groupName: '分组' + this.getId(),
                        content: [],
                        colName: this.assignmentValue,
                        value: this.assignmentValue,
                        groupShow: true
                    })
                } else {
                    if (itemList.length > 0) {
                        itemList.push({
                            groupName: '分组' + this.getId(),
                            min: itemList[itemList.length - 1].max,
                            max: parseFloat(itemList[itemList.length - 1].max) + 100,
                            closeMax: false,
                            closeMin: true
                        })
                    } else {
                        itemList.push({
                            groupName: '分组' + this.getId(),
                            min: 0,
                            max: 100,
                            closeMax: false,
                            closeMin: true
                        })
                    }
                }
                this.toParent()
            },
            // 分组名称生成随机数
            getId () {
                let date = Date.now()
                let tempId = Math.ceil(Math.random() * 100)
                return date + '' + tempId
            },
            // 保存文本和数值字段,并给分组赋值初始化
            saveColumnInfo (val) {
                this.columnInfo = val
                let tempList = this.columnInfo[1].children
                let tempList1 = this.columnInfo[2].children
                if (tempList.length > 0) {
                    tempList.forEach(item => {
                        this.itemList.push({
                            name: item.name,
                            value: item.enName,
                            type: item.type
                        })
                    })
                }
                if (tempList1.length > 0) {
                    tempList1.forEach(item => {
                        this.itemList.push({
                            name: item.name,
                            value: item.enName,
                            type: item.type
                        })
                    })
                }
                debugger
                console.info(this.itemList)
                this.assignmentValue = this.itemList[0].value
                this.qryGroupInfo(this.assignmentValue)
                this.searchFlag = true
                this.isSearch = true
            },
            // 接收编辑值
            editData (dataValue) {
                debugger
                console.info(dataValue)
                if (this.isText(dataValue.value1) === 'VARCHAR2') { // 文本情况
                    this.assignmentValue = dataValue.value1
                    console.info(dataValue.textGroups)
                    dataValue.textGroups.forEach(item => {
                        item.groupShow = true
                        item.value = this.assignmentValue
                        item.colName = this.assignmentValue
                        item.id = dataValue.fieldId
                        item.modelId = dataValue.modelId
                        let tempList = []
                        item.content.forEach(temp => {
                            tempList.push({
                                searchFlag: false,
                                value: temp
                            })
                        })
                        item.content = tempList
                    })
                    this.groupInfo = dataValue.textGroups
                    console.info(this.groupInfo)
                    this.checked = dataValue.value2 !== ''
                    this.other = dataValue.value2 === '' ? '其他' : dataValue.value2
                    this.toParent()
                } else if (this.isText(dataValue.value1) === 'NUMBER') {
                    if (dataValue.subType === '2') {
                        this.assignmentValue = dataValue.value1
                        this.assignmentMethod = dataValue.subType
                        dataValue.numberGroups.forEach(item => {
                            item.closeMax = item.closeMax !== '0'
                            item.closeMin = item.closeMin !== '0'
                        })
                        this.intervalTempList = dataValue.numberGroups
                        console.info(this.intervalTempList)
                        this.checked = dataValue.value2 !== ''
                        this.other = dataValue.value2 === '' ? '其他' : dataValue.value2
                    } else if (dataValue.subType === '3') {
                        this.assignmentValue = dataValue.value1
                        this.assignmentMethod = dataValue.subType
                        this.defaultInterval = dataValue.value3
                    }
                    let param = {
                        modelId: this.menuId,
                        fieldName: this.assignmentValue
                    }
                    ajax.post(QUERY_GROUPING, param).then(res => {
                        this.min = res.data.min
                        this.max = res.data.max
                        this.toParent()
                    })
                }
            },
            // 接收树的值进行处理
            handleTreeValue (treeValue) {
                this.columnInfo = treeValue
                let tempList = this.columnInfo[1].children
                let tempList1 = this.columnInfo[2].children
                if (tempList.length > 0) {
                    tempList.forEach(item => {
                        this.itemList.push({
                            name: item.name,
                            value: item.enName,
                            type: item.type
                        })
                    })
                }
                if (tempList1.length > 0) {
                    tempList1.forEach(item => {
                        this.itemList.push({
                            name: item.name,
                            value: item.enName,
                            type: item.type
                        })
                    })
                }
            },
            // 根据不同字段的下拉框返回分组信息
            qryGroupInfo (val) {
                    let param = {
                        modelId: this.menuId,
                        sqlColumn: [this.assignmentValue]
                    }
                    let param1 = {
                        modelId: this.menuId,
                        fieldName: this.assignmentValue
                    }
                    if (this.isText(this.assignmentValue) === 'VARCHAR2') {
                        ajax.post(GET_TABLEFILTER_INFO, param).then(res => {
                            let tempList = eval(('res.data.list[0].' + this.assignmentValue))
                            // 根据不同的字段类型处理返回的分组信息
                            let reList = []
                            tempList.forEach(temp => {
                                reList.push({
                                    searchFlag: false,
                                    value: temp
                                })
                            })
                            this.groupInfo.push({
                                groupName: '未分组',
                                content: reList,
                                colName: this.assignmentValue,
                                groupShow: true,
                                value: this.assignmentValue
                            })
                            if (sessionStorage.getItem('pageMode') === 'EDIT' && this.groupInfo.length > 1 && this.groupInfo[this.groupInfo.length - 1].groupName === '未分组') {
                                this.groupInfo.splice(this.groupInfo.length - 1, 1)
                            }
                            this.groupFlag = this.isCurrentGroup(this.assignmentValue)
                            this.toParent()
                        })
                    } else if (this.isText(this.assignmentValue) === 'NUMBER') {
                        debugger
                        ajax.post(QUERY_GROUPING, param1).then(res => {
                            this.numDataDeal(res.data.interval)
                            this.min = res.data.min
                            this.max = res.data.max
                            this.defaultInterval = res.data.step
                            this.toParent()
                        })
                    }
            },
            //  判断是否是文本
            isText (val) {
                let res = ''
                this.itemList.forEach(item => {
                    if (val === item.value) {
                        res = item.type
                    }
                })
                return res
            },
            // 下拉框对应分组给唯一标识
            isCurrentGroup (val) {
                let res = false
                this.groupInfo.forEach(item => {
                    if (item.value === val) {
                        res = true
                    }
                })
                return res
            },
            // 下拉框改变事件
            assignmentHandle () {
                this.searchFlag = true // 重置文本类值
                this.isSearch = true
                this.selectedNum = 0
                this.searchValue = ''
                this.checked = true
                this.other = '其他'
                this.disabledFlag = false
                this.groupFlag = this.isCurrentGroup(this.assignmentValue)
                this.groupInfo = []
                this.intervalTempList = []
                this.qryGroupInfo(this.assignmentValue)
            },
            // 不同类型分组传值给父组件
            toParent () {
                debugger
                console.info(this.groupInfo)
                let param = {}
                if (this.isText(this.assignmentValue) === 'VARCHAR2') { // 文本情况
                    param = {
                        value1: this.assignmentValue,
                        value2: this.checked ? this.other : '',
                        subType: '1',
                        textGroups: this.tranGroupInfo(this.groupInfo),
                        type: 'text',
                        pageMode: sessionStorage.getItem('pageMode')
                    }
                } else if (this.isText(this.assignmentValue) === 'NUMBER' && this.assignmentMethod === '2') { // 数值并且为自定义情况传参父组件
                    param = {
                        value1: this.assignmentValue,
                        value2: this.checked ? this.other : '',
                        numberGroups: this.intervalTempList,
                        subType: this.assignmentMethod,
                        min: this.min,
                        max: this.max,
                        type: 'number',
                        method: '1',
                        pageMode: sessionStorage.getItem('pageMode')
                    }
                } else if (this.isText(this.assignmentValue) === 'NUMBER' && this.assignmentMethod === '3') { // 数值并且为自动情况传参父组件
                    param = {
                        value1: this.assignmentValue,
                        value3: this.defaultInterval,
                        subType: this.assignmentMethod,
                        min: this.min,
                        max: this.max,
                        type: 'number',
                        method: '2',
                        pageMode: sessionStorage.getItem('pageMode')
                    }
                }
                this.$emit('getGrouping', param)
            },
            /** **********************文本***********************************/
            // 处理文本类分组往父组件传值的格式
            tranGroupInfo (val) {
                let res = JSON.parse(JSON.stringify(val))
                res.forEach(item => {
                    delete item.groupShow
                    delete item.value
                    let tempData = []
                    item.content.forEach(item1 => {
                        tempData.push(item1.value)
                    })
                    item.content = tempData
                })
                return res
            },
            // 文本分组的数据每项点击事件
            handleClick (e, item, groupName) {
                if (e.target.className.indexOf('checked') === -1) {
                    e.target.className = 'selectedData checked'
                    this.selectedList.push({
                        groupName: groupName,
                        value: item
                    })
                    console.info(this.selectedList)
                    this.selectedNum++
                } else {
                    e.target.className = 'selectedData'
                    this.selectedList.forEach((selectedItem, index) => {
                        if (selectedItem.value === item) {
                            this.selectedList.splice(index, 1)
                            this.selectedNum--
                        }
                    })
                }
            },
            // 删除分组
            deleteGroup (groupItem, index) {
                this.groupInfo[0].content.push.apply(this.groupInfo[0].content, groupItem.content)
                this.groupInfo.splice(index, 1)
                this.selectedNum = 0
            },
            // 移动分组事件
            dropdownClick (groupItem) {
                this.selectedNum = 0
                for (let i = 0; i < this.groupInfo.length; i++) {
                    let tempItem = this.groupInfo[i]
                    // 从总的分组集合里找到移动到的那个分组
                    if (groupItem.groupName === tempItem.groupName) {
                        let tempList = []
                        this.selectedList.forEach(item => {
                            tempList.push({
                                searchFlag: false,
                                value: item.value.value
                            })
                        })
                        console.info(tempList)
                        // 如果被选中的数据有目标数组的数据应该删除
                        groupItem.content.forEach(item1 => {
                            tempList.forEach((item2, index2) => {
                                if (item1.value === item2.value) {
                                    tempList.splice(index2, 1)
                                    $('.selectedData').removeClass('checked')
                                }
                            })
                        })
                        groupItem.content.push.apply(groupItem.content, tempList)
                    } else {
                        for (let j = 0; j < this.selectedList.length; j++) {
                            let selectedItem = this.selectedList[j]
                            if (tempItem.groupName === selectedItem.groupName) {
                                for (let k = 0; k < tempItem.content.length; k++) {
                                    if (selectedItem.value.value === tempItem.content[k].value) {
                                        tempItem.content.splice(k, 1)
                                        $('.selectedData').removeClass('checked')
                                    }
                                }
                            }
                        }
                    }
                }
                this.selectedList = []
                this.toParent()
            },
            // 文本分组名称编辑
            editGroup (groupInfo, groupItem) {
                this.$refs.renameGroup.openDialog(groupInfo, groupItem)
            },
            getName (val) {
                this.groupInfo.forEach(item => {
                    if (item === val.item) {
                        item.groupName = val.newName
                    }
                })
            },
            // 文本搜索数据项
            searchCollapse (val) {
                if (val.trim() === '') {
                    this.searchFlag = true
                    return
                }
                let param = {
                    datasetId: this.menuId,
                    fieldName: this.assignmentValue,
                    keyword: val
                }
                ajax.post(SEARCH_ADDROW, param).then(res => {
                    if (res.data.value.length === 0) {
                        this.searchFlag = false
                    } else {
                        this.searchFlag = true
                        // 从总的分组信息里找是否包含模糊查询返回的数据
                        for (let i = 0; i < this.groupInfo.length; i++) {
                            let num = 0 // 对搜索到分组data的searchFlag = false的计数，如果统计为0，则该组标题不做显示
                            let groupItem = this.groupInfo[i].content
                            for (let j = 0; j < res.data.value.length; j++) {
                                let tempItem = res.data.value[j]
                                groupItem.forEach(item => {
                                    if (item.value === tempItem) {
                                        item.searchFlag = false
                                        num++
                                    } else {
                                        item.searchFlag = true
                                    }
                                })
                            }
                            if (num === 0) {
                                this.groupInfo[i].groupShow = false
                            }
                        }
                    }
                }).catch(err => {
                    console.error(err, '查询失败！')
                })
                this.searchFlag = true
                this.isSearch = false
            },
            // 文本搜索清空事件
            clearCollapse () {
                debugger
                this.searchFlag = true
                this.isSearch = true
                this.groupInfo.forEach(item => {
                    item.groupShow = true
                    if (item.content.length > 0) {
                        item.content.forEach(item1 => {
                            if (item1.searchFlag) {
                                item1.searchFlag = false
                            }
                        })
                    }
                })
            },
            /** **********************数值***********************************/
            // 删除数值分组
            deleteNumGroup (interval, index) {
                this.intervalTempList.splice(index, 1)
            },
            // 编辑名称框给全选
            selectValue (e) {
                e.currentTarget.select()
            },
            // 后台数值数据处理，人为给分组名称
            numDataDeal (data) {
                debugger
                for (let i = 0; i < data.length - 1; i++) {
                    this.intervalTempList.push({
                        groupName: '分组' + this.getId(),
                        min: data[i] + '',
                        max: data[i + 1] + '',
                        closeMax: false,
                        closeMin: true
                    })
                }
            },
            // 验证输入框值
            numInputValidate (intervalTempList, index) {
                let msgFlag = true
                debugger
                let a = parseFloat(intervalTempList[index].min)
                let b = parseFloat(intervalTempList[index].max)
                if (a > b) {
                    this.message[index] = '请保证前面的数值小于等于后面的数值'
                    return
                }
                let currentAppend = intervalTempList[index].closeMax // '<= false'
                let currentPrepend = intervalTempList[index].closeMin // '< true'
                for (let i = 0; i < this.intervalTempList.length; i++) {
                    if (index === i) {
                        continue
                    }
                    let temp1 = this.intervalTempList[i]
                    let x = parseFloat(temp1.min)
                    let y = parseFloat(temp1.max)
                    let nextAppend = temp1.closeMax
                    let nextPrepend = temp1.closeMin
                    if (((a == y) && (currentPrepend != nextAppend)) || b < x || a > y || ((b == x) && (currentPrepend != nextAppend))) {
                        msgFlag = true
                    } else {
                        this.message[index] = '数值范围重复，请重新输入'
                        msgFlag = false
                        break
                    }
                }
                if (msgFlag) {
                    this.message[index] = null
                }
                console.info(this.message)
            },
            // // 判断message所有项是否为空
            judgmentMessage () {
                debugger
                console.info(this.message)
                let flag = true
                let sum = 0
                for (let i = 0; i < this.message.length; i++) {
                    if (this.message[i] != null) {
                        flag = false
                        break
                    }
                }
                return flag
            },
            // 前置后置下拉框符号验证
            appendHandle (intervalTempList, index) {
                this.numInputValidate(intervalTempList, index)
            },
            prependHandle (intervalTempList, index) {
                this.numInputValidate(intervalTempList, index)
            },
            otherHandle () {
                if (this.checked) {
                    this.disabledFlag = false
                } else {
                    this.disabledFlag = true
                }
            },
            // 区间间隔抛事件
            inputHandle () {
                debugger
                let pattern = /'^(([0-9]+[\\.]?[0-9]+)|[1-9])$'/
                console.info(pattern.test(parseFloat(this.defaultInterval)))
                if (pattern.test(this.defaultInterval)) {
                    this.intervalMsg1 = ''
                } else {
                    this.intervalMsg1 = '请输入正数'
                }
            },
            blurHandle () {
                this.parent()
            }
        },
        created () {
            this.assignmentMethod = '2'
            // ajax.post().then (res => {
            //
            // })
            this.defaultInterval = 700000
        }
    }
</script>

<style lang="stylus" rel="stylesheet/stylus">
    .grouping
        .cl1
            margin-top 10px
        .form-item
            margin-top 10px
            .assignment-value
                margin-left 30px
        .group-content
            height 220px
            width 98%
            border 1px solid #D8DCE5
            overflow hidden auto
        .checked
            color #1e82d2
        .input-with-select
            .el-input-group__prepend
            .el-input-group__append
              background-color #fff
        .numgroup-item
            margin-left 5%
        .erro
            color red
        .num-method
            margin-top 20px
        .intervalMsg1
            color red
            margin-left 5px
        .intervalMsg2
            color green
            margin-left 85px
            margin-top 10px
        .bottom-msg
            margin-left 60%
            margin-top 10px
            color #D8DCE5
        .bottom-msg1
            margin-left 60%
            margin-top 230px
            color #D8DCE5
        .other-group
            margin-bottom -20px
        i
            font-style normal
        .add-group
            margin-left 88%
        .interval-value
            width 193px
            margin-left 26px
</style>
